package mirkofrancuski.battleship.game;

import java.io.Serializable;

public class Coordinates implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public int horizontal, vertical;

	public Coordinates(int horizontal, int vertical) {
		super();
		this.horizontal = horizontal;
		this.vertical = vertical;
	}

	public Coordinates() {
		this(0, 0);
	}

	public Coordinates(Coordinates coordinates) {
		this(coordinates.horizontal, coordinates.vertical);
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + horizontal;
		result = prime * result + vertical;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Coordinates other = (Coordinates) obj;
		if (horizontal != other.horizontal)
			return false;
		if (vertical != other.vertical)
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "(" + horizontal + ", " + vertical + ")";
	}

}
